package com.future.lock.home.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.future.lock.R;
import com.future.lock.home.entity.bean.GateWay;

import java.util.List;

/**
 * Created by jniu on 17-12-5.
 */

public class ChooseGatewaysAdapter extends BaseQuickAdapter<GateWay,BaseViewHolder> {

    private int choosePosition = 0;

    public ChooseGatewaysAdapter(int layoutResId, @Nullable List<GateWay> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GateWay item) {
        helper.setText(R.id.tv_title,item.mac).setImageResource(R.id.iv_choose,R.mipmap.ic_choose_gateway);
        if (helper.getAdapterPosition() == choosePosition){
            helper.setImageResource(R.id.iv_choose,R.mipmap.ic_choose_gateway_pro);
        }
    }

    public void setChoosePosition(int choosePosition) {
        this.choosePosition = choosePosition;
        notifyDataSetChanged();
    }

    public int getChoosePosition() {
        return choosePosition;
    }
}
